home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / MacApp Documentation / MacApp.TECH$ Archives / 1988 / Jul 88 / Re- Difference.ks < prev    next >
Encoding:
Text File  |  1991-03-06  |  1.3 KB  |  45 lines  |  [TEXT/GEOL]

  1. Item    2909944                         25-July-88        03:59
  2.  
  3. From:   SCHMUCKER1                      Schmucker, Kurt
  4.  
  5. To:     D1220                           VarLite, Dev, Andy Meldrum
  6.  
  7. cc:     MACAPP.TECH$                    MACAPP Tech
  8.  
  9. Sub:    Re: Difference Between
  10.  
  11. Andy,
  12.  
  13.     The example you raised (object initialization) is one of the few where the
  14. difference between creating a new method and overridding an existing method is
  15. often clear.  The reason has to do with parameters.  In Object Pascal and in
  16. C++, the parameter list of an overridden method must be EXACTLY the same as the
  17. inherited method.  So, if in your MyObject class, you need some additional
  18. parameters to intialize the object (a very common case), then you would have to
  19. declare a new intialization method.  If this method were named in accordance
  20. with the Apple guidelines, then the code would look something like this:
  21.  
  22. TYPE
  23.     TMyObject = OBJECT(TObject)
  24.         fThing: SomeType;
  25.         PROCEDURE TMyObject.IMyObject(aThing: SomeType);
  26.     END;
  27.  
  28. PROCEDURE TMyObject.IMyObject(aThing: SomeType);
  29. BEGIN
  30.     SELF.IObject;
  31.     SELF.fThing := aThing;
  32. END;
  33.  
  34.  
  35.  
  36.  
  37.         If you didn't need to add a parameter, then you wouldn't HAVE to define
  38. a new initialization method.
  39.  
  40.  
  41.  
  42.                 Kurt
  43.  
  44.  
  45.